Attribute VB_Name = "mVbsAddition"
Option Explicit



Public Function ConverNull(ByVal S As String) As String
    Dim nullpos As Long
    nullpos = InStr(S, vbNullChar)
    If nullpos > 0 Then
        ConverNull = Left(S, nullpos - 1)
    Else
        ConverNull = S
    End If
End Function

Public Function Hex2String(ByVal sHex As String, Optional bUnicode As Boolean)
    Dim sByte As Variant
    Dim byChar() As Byte
    Dim i As Long
    sHex = Replace(sHex, vbCrLf, "")
    sByte = Split(sHex, " ")
    ReDim byChar(0 To UBound(sByte)) As Byte
    For i = 0 To UBound(sByte)
        byChar(i) = Val("&h" & sByte(i))
    Next
    If bUnicode Then
        Hex2String = byChar
    Else
        Hex2String = StrConv(byChar, vbUnicode)
    End If
End Function
